<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="../css/bootstrap.css">
    <title>增加学生页面</title>
    <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        function check() {
            var sno = $("#sno").val();
            var sname = $("#sname").val();
            var sage = $("#sage").val();
            var saddress = $("#saddress").val();
            if(!(sno.length > 0 && sno.length < 10)){
                alert("学号有误！必须小于10位");
                return false ;
            }
            if (!(sname.length > 1 & sname.length < 10)){
                alert("姓名长度有误！必须是2-10位");
                return false ;
            }
            return true ;
        }
    </script>
</head>
<body>

    <form method="post" action="/AddStudentServlet" onsubmit="return check()">
        <div class="form-group">
            <label for="InputSno">学号：</label>
            <input type="text" name="sno" class="form-control" id="InputSno" placeholder="Enter Sno">
        </div>
        <div class="form-group">
            <label for="InputSname">姓名：</label>
            <input type="text" name="sname" class="form-control" id="InputSname" placeholder="Enter Sname">
        </div>
        <div class="form-group">
            <label for="InputSage">年龄：</label>
            <input type="text" name="sage" class="form-control" id="InputSage" placeholder="Enter Sno">
        </div>
        <div class="form-group">
            <label for="InputSaddress">地址：</label>
            <input type="text" name="saddress" class="form-control" id="InputSaddress" placeholder="Enter Sname">
        </div>
        <input type="submit" value="新增" class="btn btn-outline-dark"/>
        <a href="/QueryAllStudentsByPageServlet" class="btn btn-outline-dark">返回</a>
    </form>

</body>
</html>
